home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / September 96 / Re Error in ODFDraw (was Re U < prev    next >
Encoding:
Internet Message Format  |  1996-09-19  |  3.3 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Error in ODFDraw (was Re: Unknown Error in OpenDoc or
  2. Sent:        9/13/96 2:11 PM
  3. Received:    9/13/96 2:11 PM
  4. From:        Troy Gaul <tgaul@apple.com>
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List
  7.  
  8.  
  9. >OK, after installing the debug version of ODFLib I get the errors, and I
  10. >tracked down the bug to an aborted drag causing the problem. I can
  11. >recreate it using ODFDraw (rev 1).
  12. >
  13. >here are the steps:
  14. >1. open a new ODFDraw doc.
  15. >2. create a simple shape.
  16. >3. drag the shape, but have the drag aborted (let it go in the menu bar
  17. >for example).
  18. >4. Close the document
  19. >
  20. >you then get the debug string:
  21. >FW_CFixedAllocator: An object of type FW_CPriv{BW|Color}PatternRep has
  22. >not been deleted prop
  23. >
  24. >which results in the Unknown OpenDoc error.
  25. >
  26. >What's up with that?
  27.  
  28. It's an exception-handling mistake in ODF 1.  It's been fixed in ODF 2.
  29. Here's the message Henri sent to me at the time (sorry for the wrapping):
  30.  
  31. ---------- cut here ----------
  32.  
  33. I found the drag refcount problem here is the method to replace
  34.  
  35. //------------------------------------------------------------------------------
  36. ----------
  37. //      FW_MDraggableFrame::Drag
  38. //------------------------------------------------------------------------------
  39. ----------
  40.  
  41. FW_Boolean FW_MDraggableFrame::Drag(Environment *ev, const FW_CMouseEvent&
  42. theMouseEvent)
  43. {
  44.         if (!theMouseEvent.WaitUntilMouseMoved(ev))
  45.                 return FALSE;
  46.  
  47. #ifdef FW_DEBUG
  48.         FW_CFrame *frame = FW_CFrame::ODtoFWFrame(ev,
  49. theMouseEvent.GetFacet(ev)->GetFrame(ev));
  50.         FW_ASSERT(frame == fFrame);
  51. #endif
  52.  
  53.         FW_CDragCommand* dragCommand = this->NewDragCommand(ev, fFrame,
  54. theMouseEvent);
  55.         if (dragCommand)
  56.         {
  57.                 FW_CPresentation* presentation = fFrame->GetPresentation(ev);
  58.                 presentation->PrivSetDragPending(TRUE);
  59.  
  60.                 short level = 0;    // Added
  61.                 FW_VOLATILE(level); // Added
  62.  
  63.                 FW_TRY
  64.                 {
  65.                         dragCommand->BeginDrag(ev, theMouseEvent);
  66.                         level = 1;                                    // Added
  67.                         dragCommand->Execute(ev);
  68.                 }
  69.                 FW_CATCH_BEGIN
  70.                 FW_CATCH_EVERYTHING()
  71.                 {
  72.                         if (level == 0)         // throw in BeginDrag
  73. // Added
  74.                                 delete dragCommand;
  75. // Added
  76.  
  77.                         presentation->PrivSetDragPending(FALSE);
  78.  
  79.                         FW_THROW_SAME();
  80.                 }
  81.                 FW_CATCH_END
  82.  
  83.                 presentation->PrivSetDragPending(FALSE);
  84.  
  85.                 return TRUE;
  86.         }
  87.  
  88.         return FALSE;
  89. }
  90.  
  91.  
  92. ........................................................................
  93.  Henri Lamiraux                                      lamiraux@apple.com
  94.  Apple Computer, Inc.                 OpenDoc(tm) Development Framework
  95. ........................................................................
  96.  
  97. ---------- cut here ----------
  98.  
  99. I incorporated this into my version of ODF 1 without incident.
  100.  
  101. _troy
  102.  
  103. ......................................................................
  104.  Troy Gaul                                            tgaul@apple.com
  105.  Apple Computer, Inc.                                   OpenDoc Parts